package multimanipulators;

import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;

import multimanipulators.converters.simple.Converter;
import multimanipulators.converters.simple.Converter_delete;
import multimanipulators.converters.simple.Converter_replaceString;
import multimanipulators.finders.Finder;
import multimanipulators.finders.Finder_HTMLTAG_ALFA;
import multimanipulators.interfaces.Converters;
import multimanipulators.interfaces.Finders;
/**
 * @author Lieven Roegiers
 * @copyright 2010
 * @project javamylibs
 * @from http://javamylibs.googlecode.com/svn/trunk/
**/
public class testALFA {
	public static void main(String[] args) {
		String text = "ABCDtE tosString ttttteeeeesssssttttt test <table><table>\n<table> cc";      
		System.out.println("<<<START:TEST>>>");        
		try {
			
            InputStream is = new ByteArrayInputStream(text.getBytes("UTF-8"));
            StreamMultiManipulatorALFA x = new StreamMultiManipulatorALFA(255);
            Map<Finders, Converters>y = new HashMap<Finders,Converters>();
            
            y.put(new Finder("Stos"),new Converter());
            //y.put(new Finder("ttttteeeeesssssttttt"),new Converter());
            y.put(new Finder("rin"),new Converter_replaceString("!!!rin!!!"));
            y.put(new Finder("test"),new Converter());
            //y.put(new Finder_HTMLTAG_ALFA(false),new Converter_delete());
            OutputStreamWriter outW = new OutputStreamWriter(System.out);
            
		    x.findAndReplace(is,y,outW);
		    outW.flush();
       }catch (UnsupportedEncodingException e) {
            e.printStackTrace();
       }catch (IOException e) {
    	    e.printStackTrace();
       }
       System.out.println("\n<<<STOP:TEST>>>");           
	}

}
